/*
 * @Author: Ping Chou
 * @Date: 2022-01-30 13:02:17
 * @LastEditTime: 2022-02-02 22:23:03
 * @LastEditors: Ping Chou
 * @Description: blog
 * @FilePath: /dojo-blog/src/BlogList.js
 */
import { Link } from "react-router-dom"
const BlogList = ({ blogs, title }) => {
  return (
    <div className='blog-list'>
      <h2>{title}</h2>
      {blogs.map((blog) => (
        <div className='blog-preview' key={blog.id}>
          <Link to={`/detail/${blog.id}`}>
            <h2>{blog.title}</h2>
            <p>Written by {blog.author}</p>
          </Link>
        </div>
      ))}
    </div>
  )
}

export default BlogList
